import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '创建日期',
    align: "center",
    dataIndex: 'createTime'
  },
  {
    title: '钱包',
    align: "center",
    dataIndex: 'transactionId'
  },
  {
    title: '用户',
    align: "center",
    dataIndex: 'accountId'
  },
  {
    title: '金额',
    align: "center",
    dataIndex: 'amount'
  },
  {
    title: '交易类型',
    align: "center",
    dataIndex: 'transactionType_dictText'
  },
  {
    title: '描述',
    align: "center",
    dataIndex: 'description'
  },
  {
    title: '状态',
    align: "center",
    dataIndex: 'status_dictText'
  },
  {
    title: '其他ID',
    align: "center",
    dataIndex: 'otherId'
  },
  {
    title: '余额',
    align: "center",
    dataIndex: 'balance'
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "创建日期",
    field: 'createTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
    //colProps: {span: 6},
  },
  {
    label: "钱包",
    field: 'transactionId',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "用户",
    field: 'accountId',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "交易类型",
    field: 'transactionType',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: "transaction_type"
    },
    //colProps: {span: 6},
  },
  {
    label: "状态",
    field: 'status',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: "transaction_status"
    },
    //colProps: {span: 6},
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '创建日期',
    field: 'createTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
    dynamicDisabled: true
  },
  {
    label: '钱包',
    field: 'transactionId',
    component: 'Input',
  },
  {
    label: '用户',
    field: 'accountId',
    component: 'Input',
  },
  {
    label: '金额',
    field: 'amount',
    component: 'InputNumber',
  },
  {
    label: '交易类型',
    field: 'transactionType',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: "transaction_type",
      type: "radio"
    },
  },
  {
    label: '描述',
    field: 'description',
    component: 'Input',
  },
  {
    label: '状态',
    field: 'status',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: "transaction_status",
      type: "radio"
    },
  },
  {
    label: '其他ID',
    field: 'otherId',
    component: 'Input',
  },
  {
    label: '余额',
    field: 'balance',
    component: 'InputNumber',
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false
  },
];

// 高级查询数据
export const superQuerySchema = {
  createTime: { title: '创建日期', order: 0, view: 'datetime', type: 'string', },
  transactionId: { title: '钱包', order: 1, view: 'text', type: 'string', },
  accountId: { title: '用户', order: 2, view: 'text', type: 'string', },
  amount: { title: '金额', order: 3, view: 'number', type: 'number', },
  transactionType: { title: '交易类型', order: 4, view: 'radio', type: 'string', dictCode: 'transaction_type', },
  description: { title: '描述', order: 5, view: 'text', type: 'string', },
  status: { title: '状态', order: 6, view: 'number', type: 'number', dictCode: 'transaction_status', },
  otherId: { title: '其他ID', order: 7, view: 'text', type: 'string', },
  balance: { title: '余额', order: 8, view: 'number', type: 'number', },
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[] {
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}